#include <iostream>
#include <vector>
#include <string>
#include <stack>

using namespace std;

class Solution
{
public:
    int evalRPN(const vector<string> &tokens)
    {
        stack<long long> tmpNum; // 这里用int也可以，反正思想是这样的，为啥用long long，好像是leetcode里需要这个，你们也可以试试int
        for(size_t i = 0;i < tokens.size(); ++ i)
        {
            if(tokens[i] == "+" || tokens[i] == "-" || tokens[i] == "*" || tokens[i] == "/")
            {
                long long num1 = tmpNum.top();
                tmpNum.pop();
                long long num2 = tmpNum.top();
                tmpNum.pop();

                if(tokens[i] == "+") tmpNum.push(num1 + num2);
                if(tokens[i] == "-") tmpNum.push(num2 - num1);
                if(tokens[i] == "*") tmpNum.push(num1 * num2);
                if(tokens[i] == "/") tmpNum.push(num2 / num1);
            }
            else
            {
                tmpNum.push(stoll(tokens[i]));
            }
            // cout << tmpNum.top() << "\n";
        }
        long long rst = tmpNum.top();
        tmpNum.pop();
        return rst;
    }
};

int main(int argc, char const *argv[])
{
    Solution s;
    cout << s.evalRPN({"4","13","5","/","+"}) << "\n";
    return 0;
}
